package com.cet.designapplication.deprecated.state;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author NSOC
 */

@Component
public class DeprecateOrderContext {

    private DeprecatedAbstractOrderState currentState;

    @Autowired
    private DeprecatedStartOrder deprecateStartOrder;

    public void setCurrentState(DeprecatedAbstractOrderState deprecatedAbstractOrderState) {
        this.currentState = deprecatedAbstractOrderState;
    }

    public DeprecatedOrder createOrder(String orderId, String productId) {
        this.currentState = deprecateStartOrder;
        return currentState.createOrder(orderId, productId, this);
    }

    public DeprecatedOrder payOrder(String orderId) {
        return currentState.payOrder(orderId, this);
    }

    public DeprecatedOrder sendOrder(String orderId) {
        return currentState.sendOrder(orderId, this);
    }

    public DeprecatedOrder receiveOrder(String orderId) {
        return currentState.receiveOrder(orderId, this);
    }

}
